﻿using LJ.EventBus.Data;

namespace LJ.EventBus.HornedSerpent;


public class EventBusMessage(IDictionary<string, string?> headers, object value)
{
    public IDictionary<string, string?> Headers { get; } = headers;

    public object Value { get; } = value;


    public string GetId()
    {
        return Headers[EventBusHeaders.MessageId]!;
    }

    public string GetName()
    {
        return Headers[EventBusHeaders.MessageName]!;
    }

    public string? GetGroup()
    {
        return Headers.TryGetValue(EventBusHeaders.Group, out var value) ? value : null;
    }
}